/**
 * @file:          Datatype.h
 * @brief:
 * @details:
 * @author:        wjh
 * @date created:  2023.06.12
 * @version:       1.0.0
 * @par copyright (c):
 *
 * @par history (desc):
 *   version:1.0.0, wjh, 2023.06.12,15:21:24
 */

#ifndef _DATATYPE_H_
#define _DATATYPE_H_

/* Include Files **************************************************************/
// #include "Type_def.h"
// #include "stdint.h"

#ifndef HARDWARE_DISABLE
// #include "core_riscv.h"
#endif

/* Macro Definition ***********************************************************/
#define TRUE 1
#define FALSE 0

// #define    NULL    0

// #define ENABLE      1
// #define DISABLE     0

#define SUCCESS 0
#define FAIL -1

// #define StepperMotor Corier_4020
#define Controller ThreeLoopPidFocV1_0
#define DriverBoard Motor_drv42
#define Encoder MT68xx
#define Mcu ch32v30x_module

#ifndef HARDWARE_DISABLE
#define __REENTRANT__
#else
#define __REENTRANT__
#endif

/* Data Type Define ***********************************************************/
// typedef unsigned char   u8;     //  8 bits
// typedef unsigned int    u16;    // 16 bits
// typedef unsigned long   u32;    // 32 bits
// typedef float f32;

typedef signed char int8;  //  8 bits
typedef signed short int16;  // 16 bits
typedef signed long int32; // 32 bits
typedef signed long long int64; // 64 bits

typedef signed char int8_t;  //  8 bits
typedef signed short int16_t;  // 16 bits
typedef signed long int32_t; // 32 bits
typedef signed long long int64_t; // 64 bits

typedef unsigned char uint8;  //  8 bits
typedef unsigned short uint16;  // 16 bits
typedef unsigned long uint32; // 32 bits
typedef unsigned long long uint64; // 64 bits

typedef unsigned char uint8_t;  //  8 bits
typedef unsigned short uint16_t;  // 16 bits
typedef unsigned long uint32_t; // 32 bits
typedef unsigned long long uint64_t; // 64 bits

typedef float float32;

typedef struct
{
    uint16 pin;
    enum GpioGeneralMode
    {
        GPIO_GENERAL_MODE_NULL = 0,
        GPIO_GENERAL_MODE_ANALOG_IN = 1,
        GPIO_GENERAL_MODE_IN_FLOATING = 2,
        GPIO_GENERAL_MODE_IN_PULL_DOWN = 3,
        GPIO_GENERAL_MODE_IN_PULL_UP = 4,
        GPIO_GENERAL_MODE_OUT_OPEN_DRAIN = 5,
        GPIO_GENERAL_MODE_OUT_PUSH_PULL = 6,
        GPIO_GENERAL_MODE_AF_OPEN_DRAIN = 7,
        GPIO_GENERAL_MODE_AF_PUSH_PULL = 8,
    } mode;
} GpioGeneralType;

typedef union DataTypeTranformer
{
    uint8_t u8[4];
    int8_t s8[4];
    uint16_t u16[2];
    int16_t s16[2];
    uint32_t u32;
    int32_t s32;
    float f32;
} DataTypeTranformer;

/* Variable Declare ***********************************************************/

/* Function Declare ***********************************************************/

#endif
